#include <stdio.h>

static int java_to_cpp(const char *src, char *dest)
{
    /* First character must be lower case. */
    if (!(*src >= 'a' && *src <= 'z'))
        return 0;

    for (;;)
    {
        while (*src >= 'a' && *src <= 'z')
            *dest++ = *src++;

        if (*src == 0 || *src == '\n')
            break;
        else if (*src >= 'A' && *src <= 'Z')
        {
            *dest++ = '_';
            *dest++ = *(src++) - 'A' + 'a';
        }
        else
            return 0;
    }
    *dest = '\0';
    return 1;
}

static int cpp_to_java(const char *src, char *dest)
{
    /* First character must be lower case. */
    if (!(*src >= 'a' && *src <= 'z'))
        return 0;
    *dest++ = *src++;

    for (;;)
    {
        while (*src >= 'a' && *src <= 'z')
            *dest++ = *src++;

        if (*src == 0 || *src == '\n')
            break;
        else if (*src == '_')
        {
            src++;
            if (!(*src >= 'a' && *src <= 'z'))
                return 0;
            *dest++ = *(src++) - 'a' + 'A';
        }
        else
            return 0;
    }
    *dest = '\0';
    return 1;
}

int main()
{
    char src[300], dest[300];
    while (fgets(src, sizeof(src), stdin))
    {
        if (java_to_cpp(src, dest) || cpp_to_java(src, dest))
            printf("%s\n", dest);
        else
            printf("Error!\n");
    }
    return 0;
}
